<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			div {
				text-align: center;
				border: 1px solid red;
				margin: 200px auto;
				height: 354px;
				width: 180px;
			}

			div>img {
				margin: 20px;
				width: 150px;
				height: 180px;
			}

			div #jihao {
				font-size: 12px;
			}

			div #num {
				width: 20px;
			}
		</style>
	</head>
	<body>
		<div>
			<img src="2.jpg"><br />
			<span id="jihao">纪梵希&nbsp;小羊皮口红304</span>
			<br />
			<b>￥<span id="price">340</span> </b>
			<br />
			<p>数量：<input type="button" id="btn1" value="-" />
			
				<input type="text" id="num" value="0" />
				
				<input type="button" id="btn2" value="+" />
				<p>总价：<span id="total"></span> </p>
			</p>

		</div>

		<script type="text/javascript">
			btn1.onclick = function() {
				var n1 =Number(num.value);
				if(num.value>0){
					--num.value;
				}
				total.innerHTML=(price.innerHTML*1*num.value*1).toFixed(2)
				// var fn=btn.value;
				// if (fn === '+') {
				// 	n1.value= (n1 + 1) * 1;
				// }

				// for(var i=0;i<arguments.length;i++){

				// }
			}
			btn2.onclick = function() {
				var n1 =Number(num.value);
				
					++num.value;
				total.innerHTML=(price.innerHTML*1*num.value*1).toFixed(2)
				// var fn=btn.value;
				// if (fn === '+') {
				// 	n1.value= (n1 + 1) * 1;
				// }
			
				// for(var i=0;i<arguments.length;i++){
			
				// }
			}
		</script>
	</body>
</html>
